import java.io.Serializable;
import java.util.Date;

/**
 * 可序列化的Person类
 * 实现Serializable接口表示该类可以被序列化
 */
public class Person implements Serializable {
    // 序列化版本ID，用于确保反序列化时的版本兼容性
    private static final long serialVersionUID = 1L;
    
    // 成员变量
    private String name;
    private int age;
    private Date birthDate;
    
    // transient关键字标记的变量不会被序列化
    private transient String sensitiveInfo;
    
    // 构造方法
    public Person(String name, int age, Date birthDate, String sensitiveInfo) {
        this.name = name;
        this.age = age;
        this.birthDate = birthDate;
        this.sensitiveInfo = sensitiveInfo;
    }
    
    // getter和setter方法
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public int getAge() {
        return age;
    }
    
    public void setAge(int age) {
        this.age = age;
    }
    
    public Date getBirthDate() {
        return birthDate;
    }
    
    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }
    
    public String getSensitiveInfo() {
        return sensitiveInfo;
    }
    
    public void setSensitiveInfo(String sensitiveInfo) {
        this.sensitiveInfo = sensitiveInfo;
    }
    
    // toString方法，用于打印对象信息
    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", birthDate=" + birthDate +
                ", sensitiveInfo='" + sensitiveInfo + '\'' +
                '}';
    }
}